<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!-- 这个地方必须得引入，否则会出现页面可缩放的问题-->
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>首页</title>
<script src="https://cdn.staticfile.org/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
    <!-- weui的相关css样式，需要引入-->
    <link rel="stylesheet" href="../css/weui.min.css">
    <link rel="stylesheet" href="../css/jquery-weui.min.css">

    <style>
        .placeholder {
            margin: 5px;
            padding: 0 10px;
            background-color: #ebebeb;
            height: 2.3em;
            line-height: 2.3em;
            text-align: center;
            color: #cfcfcf;
        }

        h1 {
            font-weight: 400;
            text-align: center;
            color: #0bb20c;
        }

    </style>
</head>
<body>
<a href="http://localhost:8888/wap/login.html">http://localhost:8888/wap/login.html</a>
<div style="margin: 35px 0;">
    <h1>表单</h1>
</div>
<div class="weui-cells__title">表单</div>
<form id="form_login">
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">用户名</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" name="uname"  placeholder="请输入用户名">
        </div>
    </div>

    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label class="weui-label">密码</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" name="upass"  placeholder="请输入密码">
        </div>
    </div>


</div
<label class="weui-agree" for="weuiAgree">
    <input class="weui-agree__checkbox" id="weuiAgree" type="checkbox">
    <span class="weui-agree__text">阅读并同意<a href="javascript:void(0);">《相关条款》</a></span>
</label>
<input type="hidden" name="c" value="userlogin">
</form>
<div class="weui-btn-area">
    <a href="javascript:login();" class="weui-btn weui-btn_primary">登录</a>
</div>
<script>
function login(){
		var url="http://fdc56.buzhizhe.com:9167/d.ashx";
		var _self=this;
		//$.get(url,function(ret){
		//    _self.ret=eval("(" + ret +")");
		//})
		$.ajax({
			cache: true,
			type: "POST",
			url:url,
			data:$('#form_login').serialize(),// 你的formid
			async: false,
			error: function(request) {
				alert("网络连接错误");
			},
			success: function(data) {
				var json=eval("(" + data +")");
        //alert("接口返回错误："+json.msg);
				if(json.ret==1){
				  alert("登录失败：："+json.msg);
				}else {
          //alert("登录成功。");
          location.href='login-ok.html';
        }

        if(json.data instanceof Array){
				  _self.ret=json;
				}
				//alert(typeof _self.ret.data);
			}
		});
}

</script>
 </body>
</html>
